package com.aimee.spinner.main.activity;

import android.graphics.Color;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.aimee.spinner.R;
import com.aimee.spinner.main.view.spinner.MyBaseEditSpinnerAdapter;
import com.aimee.spinner.third.xui.XUIManager;
import com.xuexiang.xui.utils.ResUtils;
import com.xuexiang.xui.widget.spinner.editspinner.EditSpinner;
import com.xuexiang.xui.widget.spinner.editspinner.EditSpinnerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.spinner)
    EditSpinner spinner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        XUIManager.initTheme(this);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        initView();
    }

    private void initView() {
        List<String> phoneNameList = new ArrayList<>();
        phoneNameList.add("苹果");
        phoneNameList.add("三星");
        phoneNameList.add("诺基亚");
        phoneNameList.add("小米");

//        spinner.setItems(phoneNameList);
//        spinner.setText(phoneNameList.get(0));

        MyBaseEditSpinnerAdapter adapter = new MyBaseEditSpinnerAdapter(this, phoneNameList);
        spinner.setAdapter(adapter.setTextColor(Color.GREEN)
                .setTextSize(spinner.getEditText().getTextSize()));

//        spinner.setAdapter(new EditSpinnerAdapter(this, phoneNameList).setTextColor(Color.GREEN)
//                .setTextSize(spinner.getEditText().getTextSize()));

    }


}
